package cn.iocoder.yudao.module.brokerage.record.controller.app;

import cn.iocoder.yudao.framework.business.basic.controller.PageController;
import cn.iocoder.yudao.framework.business.basic.controller.SimpleDetailController;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.brokerage.record.pojo.vo.AppBrokerageRecordQueryDTO;
import cn.iocoder.yudao.module.brokerage.record.pojo.vo.AppBrokerageRecordVO;
import cn.iocoder.yudao.module.brokerage.record.service.AppBrokerageRecordService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;

@Tag(name = "用户 App - 推广用户分佣记录")
@RestController
@RequestMapping("/brokerage/record")
@Validated
public class AppBrokerageRecordController implements SimpleDetailController<AppBrokerageRecordVO>, PageController<AppBrokerageRecordVO, AppBrokerageRecordQueryDTO> {
    @Resource
    private AppBrokerageRecordService appBrokerageRecordService;

    @Override
    public CommonResult<AppBrokerageRecordVO> getDetail(Long id) {
        return success(appBrokerageRecordService.getDetail(id, getLoginUserId()));
    }

    @Override
    public CommonResult<PageResult<AppBrokerageRecordVO>> getPage(Integer pageNo, Integer pageSize, AppBrokerageRecordQueryDTO param) {
        return success(appBrokerageRecordService.getPage(pageNo, pageSize, param, getLoginUserId()));
    }

}